// Map<int, String> feedbackModule = {
//   1: '首页',
//   2: '赛事',
//   3: '新闻',
//   4: '个人中心',
// };

Map<int, String> feedbackType = {
  1: '咨询',
  2: '建议',
  3: '投诉',
};

class FeedbackItemContent {
  late String text;
  late List<String> images;

  FeedbackItemContent(Map<String, dynamic> json) {
    text = "${json["text"]}";
    if (json["images"] != null) {
      images =
          (json["images"] as List<dynamic>).map((e) => e as String).toList();
    } else {
      images = [];
    }
  }

  Map<String, dynamic> get json {
    return Map<String, dynamic>()
      ..["text"] = text
      ..["images"] = images;
  }
}

class FeedbackItem {
  late int id;
  // late int module;
  // late String subModule;
  late int type;
  late FeedbackItemContent content;
  late int createTime;
  late String typeName;
  FeedbackItem(Map<String, dynamic> json) {
    id = int.parse("${json["id"]}");
    // module = int.parse("${json["module"]}");
    // subModule = json["sub_module"] ?? '';
    type = int.tryParse("${json["type"]}") ?? 0;
    typeName = json["type_name"] ?? "";
    content = FeedbackItemContent(json["content"]);
    createTime = int.parse("${json["create_time"]}");
  }

  Map<String, dynamic> get json {
    return Map<String, dynamic>()
      ..["id"] = id
      // ..["module"] = module
      // ..["sub_module"] = subModule
      ..["type"] = type
      ..["content"] = content
      ..["createTime"] = createTime
      ..["typeName"] = typeName;
  }
}

class FeedbackDetailItem {
  late int itemType;
  late FeedbackItemContent content;
  late int createTime;

  FeedbackDetailItem(Map<String, dynamic> json) {
    itemType = int.parse("${json["item_type"]}");
    content = FeedbackItemContent(json["content"]);
    createTime = int.parse("${json["create_time"]}");
  }

  Map<String, dynamic> get json {
    return Map<String, dynamic>()
      ..["item_type"] = itemType
      ..["content"] = content
      ..["createTime"] = createTime;
  }
}

class FeedbackDetailData {
  // late int module;
  // late String subModule;
  late int type;
  late FeedbackItemContent content;
  late String typeName;
  late int createTime;
  int? moduleId;
  late List<FeedbackDetailItem> list;

  FeedbackDetailData(Map<String, dynamic> json) {
    // module = int.parse("${json["module"]}");
    // subModule = json["sub_module"] ?? '';
    type = int.tryParse("${json["type"]}") ?? 0;
    content = FeedbackItemContent(json["content"]);
    createTime = int.parse("${json["create_time"]}");
    typeName = json["type_name"] ?? "";
    moduleId = json['module_id'];
    list = (json["list"] as List<dynamic>)
        .map((e) => FeedbackDetailItem(e))
        .toList();
  }

  Map<String, dynamic> get json {
    return Map<String, dynamic>()
      // ..["module"] = module
      // ..["sub_module"] = subModule
      ..["type"] = type
      ..["content"] = content
      ..["createTime"] = createTime
      ..["list"] = list
      ..["typeName"] = typeName
      ..['module_id'] = moduleId;
  }
}
